package com.ys.web.sys.redisMessage;

import com.ys.utils.redis.Redis;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@RestController
@RequestMapping("/sys/re/mena/")
public class RedisMenagerController {

    @RequestMapping("dl")
    public int dl(){
        Set<String> keys = Redis.key.keys("video-user-play-*");
        return keys.size();
    }

    @RequestMapping("dl2")
    public int dl2(){
        Set<String> keys = Redis.key.keys("video-user-play-*");
        keys.forEach(x->{
            try {
                Redis.zSet.zremrangebyrank(x,50,30000);
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        return keys.size();
    }
}
